home *** CD-ROM | disk | FTP | other *** search
- /*
- File: Info.cpp
-
- Contains: implementation of the Info object including ShowPartFrameInfo
-
- Owned by: Ed Lai
-
- Copyright: © 1993 - 1996 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- <21> 12/19/96 eeh 1614389: return false if user cancels
- <20> 9/24/96 eeh 1315228: cleanup
- <19> 9/10/96 eeh 1386008: AppleGuide support (incomplete)
- <18> 6/22/96 EL 1344140: dialogLib's ShowPartFrameInfo now
- returns ODError.
- <17> 6/21/96 jpa T10002: Changed min/default heap size.
- (Also improved debug msg from
- GetSharedLibrary.)
- <16> 6/7/96 eeh T10017: function ptrs must be extern C
- <15> 6/7/96 eeh T10017: use current architecture
- <14> 6/7/96 eeh T10017: return CFM errors
- <13> 6/7/96 eeh T10017: move most dlg stuff to InfoDlg.cpp
- <12> 6/5/96 EL 1355529: Use menu item count to determine
- the translation menu item.
- <11> 6/4/96 EL 1323543: Remove some unneeded comment from
- last check in.
- <10> 6/4/96 EL 1323543: Bundled checkbox is now two radio
- buttons. 1289557: Alert for bad file name
- and comment too long.
- <9> 5/30/96 CC 1299865: ShowPartFrameInfo: If the kind
- popup is changed, keep the same editor
- unless it doesn't support the new kind.
- <8> 5/29/96 TJ Worked around temp var scoping problem.
- <7> 5/28/96 EL #1234149: Remove staticText covering
- checkbox so that checkbox can be shown as
- dimmed for read only document.
- <6> 5/24/96 jpa 1246074: Fix SOM_CATCH. Also: Disable CW
- optimizer on GetPartFrameInfo to avoid CW8
- compiler crashes.
- <5> 5/22/96 EL #1263100: If cancel out of SynchNSTable,
- reraise the error.
- <4> 5/3/96 EL 1313942: release settings extension before
- editor is swapped. 1329522: document info
- size dialog button will be inverted on
- mouse down to give user feedback.
- <3> 3/20/96 EL 1289563: for read-only field from read-only
- documents, disallow editing. Allow viewing
- of heap size info from read-only document
- but don't allow editing.
- <2> 1/12/96 CC 1302700: ShowPartFrameInfo: Show part id if
- frame is non-persistent.
- 1295846: ShowPartFrameInfo: ASSERT that
- part is a part wrapper.
-
- In Progress:
-
- */
-
- #define _USE_DIALOGS_LIB_
-
- #define ODInfo_Class_Source
- #define VARIABLE_MACROS
- #include <Info.xih>
-
- #ifndef _USERSRCM_
- #include <UseRsrcM.h>
- #endif
-
- #ifndef SOM_ODSession_xh
- #include <ODSessn.xh>
- #endif
-
- #ifndef SOM_ODDraft_xh
- #include <Draft.xh>
- #endif
-
- #ifndef SOM_ODDocument_xh
- #include <Document.xh>
- #endif
-
- #ifndef SOM_ODContainer_xh
- #include <ODCtr.xh>
- #endif
-
- #ifndef SOM_ODWindowState_xh
- #include <WinStat.xh>
- #endif
-
- #ifndef SOM_ODWindow_xh
- #include <Window.xh>
- #endif
-
- #ifndef SOM_ODFrameFacetIterator_xh
- #include <FrFaItr.xh>
- #endif
-
- #ifndef _INFODEFS_
- #include <InfoDefs.h>
- #endif
-
- #ifndef _PREFS_
- #include "Prefs.h"
- #endif
-
- #ifndef SOM_Module_OpenDoc_StdProps_defined
- #include <StdProps.xh>
- #endif
-
- #ifndef SOM_Module_OpenDoc_StdTypes_defined
- #include <StdTypes.xh>
- #endif
-
- #ifndef _ODUTILS_
- #include <ODUtils.h>
- #endif
-
- #ifndef SOM_ODFrame_xh
- #include <Frame.xh>
- #endif
-
- #ifndef SOM_ODFacet_xh
- #include <Facet.xh>
- #endif
-
- #ifndef SOM_ODPart_xh
- #include <Part.xh>
- #endif
-
- #ifndef SOM_ODStorageUnit_xh
- #include <StorageU.xh>
- #endif
-
- #ifndef SOM_ODStorageUnitView_xh
- #include <SUView.xh>
- #endif
-
- #ifndef SOM_ODSettingsExtension_xh
- #include <Settings.xh>
- #endif
-
- #ifndef SOM_Module_OpenDoc_StandardExtensions_defined
- #include <StdExts.xh>
- #endif
-
- #ifndef _PASCLSTR_
- #include <PasclStr.h>
- #endif
-
- #ifndef _ODMEMORY_
- #include <ODMemory.h>
- #endif
-
- #ifndef _PLFMFILE_
- #include <PlfmFile.h>
- #endif
-
- #ifndef SOM_ODTypeList_xh
- #include <TypeList.xh>
- #endif
-
- #ifndef SOM_ODTypeListIterator_xh
- #include <TypLsItr.xh>
- #endif
-
- #ifndef _BINDNGH_
- #include <BindngH.h>
- #endif
-
- #ifndef _BNDNSUTL_
- #include <BndNSUtl.h>
- #endif
-
- #ifndef _DLOGUTIL_
- #include <DlogUtil.h>
- #endif
-
- #ifndef _DOCUTILS_
- #include <DocUtils.h>
- #endif
-
- #ifndef _TEMPOBJ_
- #include <TempObj.h>
- #endif
-
- #ifndef _EXCEPT_
- #include <Except.h>
- #endif
-
- #ifndef _ITEXT_
- #include <IText.h>
- #endif
-
- #ifndef _STORUTIL_
- #include <StorUtil.h>
- #endif
-
- #ifndef _EDITRSET_
- #include <EditrSet.h>
- #endif
-
- #ifndef _ISOSTR_
- #include <ISOStr.h>
- #endif
-
- #ifdef __SC__
- #ifndef __PACKAGES__
- #include <Packages.h>
- #endif
- #else
- #ifndef __TEXTUTILS__
- #include <TextUtils.h>
- #endif
- #endif
-
- #ifndef __STRING__
- #include <String.h>
- #endif
-
- #ifndef __GESTALTEQU__
- #include <GestaltEqu.h>
- #endif
-
- #ifndef __DIALOGS__
- #include <Dialogs.h>
- #endif
-
- #ifndef __TEXTEDIT__
- #include <TextEdit.h>
- #endif
-
- #ifndef __TOOLUTILS__
- #include <ToolUtils.h>
- #endif
-
- #ifndef __FONTS__
- #include <Fonts.h>
- #endif
-
- #ifndef __CONTROLS__
- #include <Controls.h>
- #endif
-
- #ifndef SOM_ODPartWrapper_xh
- #include <PartWrap.xh>
- #endif
-
- #ifndef _INFOUTIL_
- #include <InfoUtil.h>
- #endif
-
- #ifndef _STDTYPIO_
- #include <StdTypIO.h>
- #endif
-
- #ifndef _TEMPOBJ_
- #include <TempObj.h>
- #endif
-
- #ifndef SOM_ODTranslation_xh
- #include <Translt.xh>
- #endif
-
- #ifndef SOM_ODDispatcher_xh
- #include <Disptch.xh>
- #endif
-
- #ifndef __PALETTES__
- #include <Palettes.h>
- #endif
-
- #ifndef __ICONS__
- #include <Icons.h>
- #endif
-
- #ifndef __FOLDERS__
- #include <Folders.h>
- #endif
-
- #ifndef _TRANSUTL_
- #include <TransUtl.h>
- #endif
-
- #ifndef __MENUS__
- #include <Menus.h>
- #endif
-
- #ifndef SOM_ODStorageSystem_xh
- #include <ODStor.xh>
- #endif
-
- #ifndef SOM_ODNameSpaceManager_xh
- #include <NmSpcMg.xh>
- #endif
-
- #ifndef _ORDCOLL_
- #include "OrdColl.h"
- #endif
-
- #pragma segment ODInfo
-
- #ifdef _USE_DIALOGS_LIB_
-
- //==============================================================================
- // InitInfo
- //==============================================================================
-
- SOM_Scope void SOMLINK ODInfoInitInfo(ODInfo *somSelf, Environment *ev,
- ODSession* session)
- {
- ODInfoData *somThis = ODInfoGetData(somSelf);
- ODInfoMethodDebug("ODInfo","ODInfoInitInfo");
-
- _fSession = session;
- // gSession = _fSession;
- }
-
- //==============================================================================
- // ShowPartFrameInfo
- //==============================================================================
-
- static pascal ODBoolean CallCheckScriptFirstThenStdFilterProc( DialogPtr dialog,
- EventRecord *event, short *itemHit)
- {
- return CheckKeyScriptChangeFilterProc( dialog, event, itemHit )
- || ODDialogFilterProc( dialog, event, itemHit );
- }
-
- // <eeh> this ought to be moved to a utility file at some point
- OSErr LoadODSharedLibrary( Str63 libName, Str255 entryName,
- CFragConnectionID* connID, void** entryPoint );
- OSErr LoadODSharedLibrary( Str63 libName, Str255 entryName,
- CFragConnectionID* connID, void** entryPoint )
- {
- Ptr ignore;
- Str255 errName;
- // CFragConnectionID connID;
-
- OSErr err = GetSharedLibrary( libName, kCurrentCFragArch, 1, connID,
- &ignore, errName );
- if ( err == noErr )
- {
- CFragSymbolClass symClass;
- err = FindSymbol( *connID, entryName, (Ptr*)entryPoint, &symClass );
- if ( err == noErr )
- WASSERT( symClass == kTVectorCFragSymbol );
- else
- {
- WARN( "Didn't find symbol address" );
- *entryPoint = kODNULL;
- }
- }
- else
- {
- #if ODDebug
- PascalToCString( errName );
- WARN( "GetSharedLibrary returned error %d '%s'", err, errName );
- #endif
- }
-
- return err;
- }
-
- void UnloadODSharedLibrary( CFragConnectionID* connID );
- void UnloadODSharedLibrary( CFragConnectionID* connID )
- {
- OSErr err = CloseConnection( connID );
- WASSERT( err == noErr );
- }
-
- #ifdef __cplusplus
- extern "C" {
- #endif
- typedef ODError (*InfoDialogEntry)( Environment *ev,
- ODSession* session, ODFacet* facet, ODBoolean allowEditing);
- #ifdef __cplusplus
- }
- #endif
-
- SOM_Scope ODBoolean SOMLINK ODInfoShowPartFrameInfo(ODInfo *somSelf, Environment *ev,
- ODFacet* facet, ODBoolean allowEditing)
- {
- ODInfoData *somThis = ODInfoGetData(somSelf);
- ODInfoMethodDebug("ODInfo","ODInfoShowPartFrameInfo");
-
- // already volatile since address taken....
- InfoDialogEntry ide = kODNULL; ODVolatile( ide );
- CFragConnectionID connID; ODVolatile( connID );
- ODBoolean result = kODFalse; ODVolatile(result);
-
- SOM_TRY
- ODError error = 0;
- THROW_IF_ERROR( LoadODSharedLibrary( "\pDialogsLib",
- "\pShowPartFrameInfo", &connID, (void**)&ide ) );
- error = (*ide)( ev, _fSession, facet, allowEditing );
- if (error && (error != userCanceledErr))
- THROW(error);
- UnloadODSharedLibrary( &connID );
- result = error != userCanceledErr;
- SOM_CATCH_ALL
- if ( ide != kODNULL ) // we loaded the library
- UnloadODSharedLibrary( &connID );
- // reraise happens automatically
- SOM_ENDTRY
- return result;
- }
-
- SOM_Scope void SOMLINK ODInfosomUninit(ODInfo *somSelf)
- {
- //ODInfoData *somThis = ODInfoGetData(somSelf);
- ODInfoMethodDebug("ODInfo","ODInfosomUninit");
-
- ODInfo_parent_ODObject_somUninit(somSelf);
- }
-
- #else
- error will robinson; don't compile me!!!
- #endif